function debounce(fn, delay) {
    var timer;
    return function() {
        clearTimeout(timer);
        var that = this;
        timer = setTimeout(function() {
            fn.call(that);
        })
    }
}

function throttle(fn, delay) {
    var getTime = 0;
    return function() {
        var backTime = new Date();
        var that = this;
        if (backTime - getTime > delay) {
            fn.call(that);
            getTime = backTime;
        } else {
            console.log("触发的时间间隔时间太短");
        }


    }
}